package com.schoolgard.base.interceptor;

import java.io.PrintWriter;
import java.util.Map;

import javax.servlet.http.HttpServletResponse;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;

public class AuthorityInterceptor extends MethodFilterInterceptor{
	
	private static final long serialVersionUID = 201201152133L;

	/**
	 * 权限处理拦截器
	 */
	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
		
		ActionContext actionContext = invocation.getInvocationContext();
	    Map session=actionContext.getSession();  
	    HttpServletResponse response = (HttpServletResponse) actionContext.get(org.apache.struts2.StrutsStatics.HTTP_RESPONSE);
	    PrintWriter print = response.getWriter();
	    print.write("$('#userAdd').remove()");
        //TUser user = (TUser)session.get("user");
        //if(user != null ){ //&& user.getEffect().equals("true") 暂时去掉
        	//return invocation.invoke();
        //}
		return invocation.invoke();
	}

	@Override
	protected String doIntercept(ActionInvocation invocation) throws Exception {
		
		return null;
	}
}
